#@adminLayout() 

#define main()

<div class="jfa-header-box" id="jfa-header-box">
	<div class="jfa-crumbs" id="jfa-crumbs">账户管理 / 修改</div>
	<div class="jfa-search-box"></div>
	#include("/_view/_admin/common/_header_right.html")
</div>

### 内容区域
<div class="jfa-content-box" id="jfa-content-box">
	<div class="jfa-content" id="jfa-content">

		<form class="form-horizontal clearfix margin-top-30"
			id="myArticleForm" action="/admin/account/update" method="post">
			<input type="hidden" name="account.id" value="#(account.id)" />

			<div class="form-group">
				<label class="col-sm-4 control-label">头像</label>
				<div class="col-sm-8">
					<img src="/upload/avatar/#(account.avatar)">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-4 control-label">昵称</label>
				<div class="col-sm-8">
					<input type="text" class="form-control" name="account.nickName"
						value="#(account.nickName)">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-4 control-label">邮箱</label>
				<div class="col-sm-8">
					<input type="email" class="form-control" name="account.userName"
						value="#(account.userName)" placeholder="填写合法的 email">
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-4 col-sm-8">
					<input class="btn btn-primary" type="submit" value="提交" />
					#permission("/admin/account/avatar") <a data-pjax
						href="/admin/account/avatar?accountId=#(account.id)&p=#(p)"
						class="change-avatar">更换头像</a> #end
				</div>
			</div>
		</form>
	</div>
	<!-- END OF jfa-content -->
</div>
<!-- END OF jfa-content-box -->

<style type="text/css">
#myArticleForm {
	width: 500px;
}

.form-group {
	margin-bottom: 25px;
}

.jfa-content label {
	line-height: 1;
	vertical-align: baseline;
	color: #23527c;
	font-size: 20px;
	font-weight: normal;
	margin-bottom: 8px;;
}

.change-avatar {
	text-decoration: underline;
	display: inline-block;
	margin: 0 0 0 25px;
	vertical-align: bottom;
	font-size: 16px;
}
</style>

<script type="text/javascript">
	$(document).ready(function() {
		$("#myArticleForm").ajaxForm({
			dataType: "json"
			, beforeSubmit: function(formData, jqForm, options) {}
			, success: function(ret) {
				if (ret.state == "ok") {
					location.href = "/admin/account?p=#(p ?? 1)";
				} else {
					showFailMsg(ret.msg);
				}
			}
			, error: function(ret) {alert(ret.statusText);}
			, complete: function(ret) {} 	      // 无论是 success 还是 error，最终都会被回调
		});
	});
</script>

#end
